home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGSCAL
/
TBUTIL2.LZH
/
BENCHMRK.PAS
next >
Wrap
Pascal/Delphi Source File
|
1984-08-27
|
967b
|
39 lines
PROGRAM BENCH_MARK;
{ This program was converted from BASIC into Pascal.
FLOATING-POINT BENCHMARK
The following is a program to test the accuracy of floating
point functions (from Sept. DR DOBBS):
10 A=1
20 FOR I%=1 TO 2499
30 A=TAN(ATN(EXP(LOG(SQR(A*A))))) + 1
40 NEXT
50 PRINT A
60 STOP
The correct printout is A=2500 exactly.
IBM-PC BASIC 1.0 fails miserably, giving A=2179.8 (only 1 sig-
nificant figure of accuracy!). In contrast, an APPLE II or
Commodore 64 gives 2500 to at least 7 figures. Using the 8087
with a polyFORTH version of the benchmark, I obtained 2500 to
13 figures in 5.0 seconds. (NOTE: See March,84 D. DOBBS for
the results aginst many systems.)
}
VAR
a : REAL;
i : INTEGER;
BEGIN
a:=1;
FOR i:= 1 TO 2499 DO
BEGIN
a:= ARCTAN( EXP( LN(SQRT(a * a)) ) );
a:= (SIN(a) / COS(a)) + 1;
END;
WRITELN(a:3:11);
END.